(function($){
	$.fn.j_hideandshow = function ($obj,beginCall,endCall){		
		var _this = $(this);
		_this.mouseover(function (){
			$obj.show();
			if(beginCall)beginCall();
			$(document).mousemove(function (event){
				var _target = $(event.target);
				var id = $obj.attr("id");
				if(_target.attr("id")==id)return;				
				else if(_this.attr("id")==_target.attr("id")) return;
				else if(_this[0].contains(_target[0]))	return;
				else if($obj[0].contains(_target[0])) return;				
				if(endCall) endCall();
				$obj.hide();
				$(document).unbind("mousemove");
			});
		});
		if(endCall){
			$obj.find(".close").bind("click",function(){
				$obj.hide();
				endCall();
				return false;
			});
		}
	};
})(jQuery);